package cn.bdqn.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class UserServlet extends HttpServlet {

	

	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		response.setCharacterEncoding("utf-8");
		String name=request.getParameter("username");
		System.out.println("111"+name);
		boolean data=false;//（该句话是验证jQuery的ajax）
		//int data=0;//验证json的ajax格式
		if(name.equals("jack")||name.equals("tom")){
			data=false;
			//data=1;
			response.getWriter().print(data);//将反应传回服务器
		}else{
			data=true;
			//data=2;
			response.getWriter().print(data);
		}
	}

	
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		this.doPost(request, response);

		
	}

	

}
